/*
 * InstanceDuplicater.cpp
 *
 *  Created on: Jul 1, 2012
 *      Author: gonzalo
 */

#include "InstanceDuplicater.h"

#include "../DTOEvent.h"
#include "../DTOShipStatus.h"
#include "../DTOFinHandshake.h"
#include "../DTOExplosion.h"
#include "../DTOBonus.h"
#include "../DTOCliente.h"
#include "../DTOAsteroide.h"
#include "../DTOShipAction.h"
#include "../DTOImage.h"



DTO* InstanceDuplicater::duplicate(DTO* in) {
	DTO* out = NULL;

	switch (in->getType()) {
	case EVENT:
		out = new DTOEvent(*(DTOEvent*) in);
		break;
	case SHIP_STATUS:
		out = new DTOShipStatus(*(DTOShipStatus*) in);
		break;
	case ASTEROIDE_STATUS:
		out = new DTOAsteroide(*(DTOAsteroide*) in);
		break;
	case TIPO_ASTEROIDE:
		out = new DTOTipoAsteroide(*(DTOTipoAsteroide*) in);
		break;
	case CLIENTE:
		out = new DTOCliente(*(DTOCliente*) in);
		break;
	case SHIP_ACTION:
		out = new DTOShipAction(*(DTOShipAction*) in);
		break;
	case NEW_BONUS:
		out = new DTOBonus(*(DTOBonus*) in);
		break;
	case EQUIPMENT_STATUS:
		out = new DTOEquipment(*(DTOEquipment*) in);
		break;
	case NEW_EXPLOSION:
		out = new DTOExplosion(*(DTOExplosion*) in);
		break;
	case FIN_HANDSHAKE:
		out = new DTOFinHandshake(*(DTOFinHandshake*) in);
		break;
	case IMAGE:
		out = new DTOImage(*(DTOImage*) in);
		break;
	}

	return out;
}
